Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6150905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:41:23+00:00 2026-05-23T19:41:23+00:00

I have a Shapefile map of Maryland separated by zipcode. What I’d like to

  • 0

I have a Shapefile map of Maryland separated by zipcode. What I’d like to do is color each area based on a value I’m looking up in a database. Currently, I’m using ASP.NET with the SharpMap package. The basic questions are:

1) How do I associate a shape with its zipcode? I can generate the list of zipcodes using SharpMap’s ExecuteIntersectionQuery with the BoundingBox set as the extent of the map, but I have no idea how to then connect each row of the resulting table with the shape it represents.

2) Once I have access to an individual shape and know what color I want, how do I assign the color to the shape? In SharpMap, I can color a VectorLayer, but a VectorLayer is generated from a source .shp file, not a shape.

I’m open to using other free map packages besides SharpMap (so no ArcGIS), but for legal reasons I can’t use GoogleMaps.

I feel like this should be relatively simple, but trying to find any decent resource for SharpMap is pretty difficult.

EDIT: Alright, I’ve made a lot of process just by reading over what documentation there is. By setting the FilterDelegate of ShapeFile, I can make a layer consist of only the rows where the zip code matches a certain value. Now my only problem is making the delegate filter look for a different zip code each time. Can I pass another parameter besides the FeatureDataRow? Should I resort to a global variable?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:41:24+00:00Added an answer on May 23, 2026 at 7:41 pm

    You’ll need to use thematics to do this.

    I’ll assume you already have some code that configures your map and it’s layers. Your shapefile is a VectorLayer.

    VectorLayer shapefileLayer = GetMyShapefileLayer();
    shapefileLayer.Theme = new SharpMap.Rendering.Thematics.CustomTheme(GetStyleForShape);
    

    Then, method GetStyleForShape is called every time the map needs a style for rendering. It looks like this:-

    private SharpMap.Styles.VectorStyle GetStyleForShape(SharpMap.Data.FeatureDataRow row, SharpMap.Layers.Layer layer)
        {
    }
    

    In the method, you create and return a VectorStyle. The table data associated with the feature it’s trying to render is passed as a parameter to this method.

    So you can use the row parameter to get your zip code, do whatever logic you need to do to calculate it’s style, configure that style and return it.

    This method (potentially) gets called a lot, so consider storing the styles and reusing them, rather than recreating them every time.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have 3 shapefile ready in a map file, and rendering it on mapserver.
I have a shapefile with regions with polygons, and can successfully use PlotOnStaticMap like
I have some shapefile (demographic/heat map data in the USA, such as crime in
I am looking for a map application with the following: Windows based. City/Town street
I have a ESRI shapefile (from here: http://pubs.usgs.gov/ds/425/ ). I looking to use python
I have a huge shapefile of 36.000 non-overlapping polygones (city boundaries). I want to
I have a controller that handles file uploads. Ultimately I would like to be
I have a PostgreSQL\PostGIS spatial database which contains Hebrew text columns. The system runs
I have code that makes a shapefile but the number of fields is dependent
I have a Python dictionary that I generated from an arcgis shapefile. The dictionary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.